<?php


namespace app\admin\controller;
use app\admin\model\Admin as AdminModel;
use think\Controller;

class Admin extends Controller
{
    public function manage(){
        //获取所有管理员的信息
        $model=new AdminModel();
        $adata = $model->getList();
        $this->assign('adata', $adata);
        return $this->fetch();
    }

   public function add(){
        return $this->fetch();
    }

   public function doadd(){
        $data=$this->request->param();
        $model=new AdminModel();
        $res=$model->save($data);
        if($res){
            return alert_success('添加成功','Admin/manage');
        }else{
            return alert_error('添加失败，请检测输入!');
        }

    }
    public function del($no)
    {
        $model=new AdminModel();
        if ($model->delManage($no)) {
            return alert_success('删除成功','Admin/manage');
        } else {
            return alert_error('删除失败','Admin/manage');
        }
    }
}